import { getCookie } from "./cookie";

export type UserInfo = {
    username: string,
    avatar: string,
    email?: string,
    ID: string,
    role_ID: string,
    menu: string[],
    rules: string[]
}
export default function getUserInfo() : UserInfo | null {
    let userInfo = getCookie('userInfo');
    let user: any = {}
    if (userInfo) {
        user = JSON.parse(decodeURIComponent(userInfo as string));
        user.avatar = 'https://anran233.com/img/file-1677931608455.jpeg';
        return user 
    }
    return null;
    
} 